﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>抄送</title>
    <!--
    1, 退回界面。
    2，需要 FK_Flow, FK_Node,WorkID, FID.
    3, 调用方法 CC.htm?FK_Flow=001&FK_Node=103&WorkID=232&FID=23
    -->
    <meta http-equiv="Access-Control-Allow-Origin" content="*" />
    <link href="../Scripts/bootstrap/css/bootstrap.css" rel="stylesheet" />
    <link href="../Scripts/bootstrap/css/components-rounded.css" rel="stylesheet" />
    <link href="../Scripts/bootstrap/css/font-awesome.css" rel="stylesheet" />
    <link href="../Scripts/bootstrap/css/themes/default/style.min.css" rel="stylesheet" />
    <link href="../../DataUser/Style/ccbpm.css" rel="Stylesheet" />
    <script type="text/javascript" src="../Scripts/QueryString.js"></script>
    <script type="text/javascript" src="../Scripts/QueryString.js"></script>
    <script type="text/javascript" src="../Scripts/bootstrap/js/jquery.min.js"></script>
    <script type="text/javascript" src="../Scripts/bootstrap/js/jquery.cokie.min.js"></script>
    <script type="text/javascript" src="../Scripts/bootstrap/js/bootstrap.min.js"></script>
    <link href="../../DataUser/Style/Table0.css" rel="Stylesheet" />
    <!-- 导入配置文件. -->
    <script type="text/javascript" src="../Scripts/config.js"></script>
    <script type="text/javascript" src="../Comm/Gener.js"></script>

    <style type="text/css">
        body {
            background: transparent;
        }

            body div {
                text-align: left;
            }

        #Message {
            width: 100%;
        }
        #SelectEmp {
            position: relative;
            width: 300px;
            border-top: 0;
            display: none;
            margin-top: 5px;
        }

        .item {
            padding: 3px 5px;
            cursor: pointer;
            float: left;
            width: 190px;
            line-height: 20px;
            display: inline-block;
            background-color: #F7F7F7;
        }

        #next {
            float: right;
            position: relative;
            width: auto;
            margin-right: 10px;
        }

        .addbg {
            background: #CFCFCF;
        }

        button {
            background: #fff;
            color: #000;
            border: 1px solid #ccc !important;
            border-radius: 3px;
            margin: 5px 3px 5px 3px;
            padding: 4px 15px;
        }

            button:hover {
                background: #f5f5f5 !important;
                color: #000;
                border: 1px solid #ccc !important;
            }
    </style>
    <script type="text/javascript">
        var param = {};
        var isFrameCross = GetQueryString("isFrameCross");
        $(function () {

            // 如果您要把该页面转入其他页面，请按照如下方式处理.
            var webuser = new WebUser();
            if (webuser.CustomerNo == "GXJSZX") {
                var url = window.location.href;
                url = url.replace('CC.htm?', '../../App/gxjtoaPicker/userOrgPicker.html?IsCC=1&');
                window.location.href = url;
                return;
            }

            Help();

            //初始化页面移交页面
            param = {
                FK_Node: GetQueryString('FK_Node'),
                WorkID: GetQueryString('WorkID'),
                FID: GetQueryString('FID'),
                Message: GetQueryString('Info'),
                FK_Flow: GetQueryString("FK_Flow")
            };

            $('#Msg').val(param.Message);

            //初始化人员选择窗口
            var selectEmpModalHtml = '<div class="modal fade" id="selectEmpsModal">' +
                '<div class="modal-dialog" style="width:700px;">'
                + '<div class="modal-content" >'
                + '<div class="modal-header">'
                + '<button type="button" class="close" style="color:white;opacity:1;" data-dismiss="modal" aria-hidden="true">&times;</button>'
                + '<h4 class="modal-title">选择抄送人</h4>'
                + '</div>'
                + '<div class="modal-body">'
                + '<iframe style="width:100%;border:0px;height:400px;" id="iframeSelectEmpsForm" name="iframeSelectEmpsForm"></iframe>'
                + '</div>'
                + '</div><!-- /.modal-content -->'
                + '</div><!-- /.modal-dialog -->'
                + '</div>';

            $('body').append($(selectEmpModalHtml));
            var dept = getQueryStringByNameFromUrl("?" + $.cookie('CCS'), "FK_Dept");
            if (dept == null || dept == '' || dept == undefined) {
                dept = $.cookie('FK_Dept');
            }
            if (dept == undefined) {
                var u = new WebUser();
                dept = u.FK_Dept;
            }
            var url = "SelectEmps.htm?FK_Dept=" + dept + "&FK_Node=" + GetQueryString("FK_Node") + "&IsSelectMore=1" + "&s=" + Math.random();
            //  url = url.replace('101', '10102');
            url = url.replace('=101&', '=10102&');

            $('#iframeSelectEmpsForm').attr('src', url);
            $('#Btn_SelectEmps').bind('click', function () { $('#selectEmpsModal').modal().show(); });
            //$("section").show();
            $(".Msg").hide();



            //查询出来抄送的信息.
            var ccs = new Entities("BP.WF.CCLists");
            ccs.Retrieve("FK_Node", GetQueryString("FK_Node"), "WorkID", GetQueryString("WorkID"));

            BindTable(ccs);

        });

        function BindTable(ccs) {

            for (var i = 0; i < ccs.length; i++) {

                var cc = ccs[i];

                var row = "";
                row += "<tr>";
                // row += "<td>" + i + "</td>";
                row += "<td>" + cc.CCTo + "," + cc.CCToName + "</td>";
                row += "<td  title='" + cc.CCToDeptName + "' >" + cc.CCToDeptName + "</td>";

                row += "<td><a href=\"javascript:DeleteIt('" + cc.MyPK + "'," + i + ");\" >移除</a></td>";

                row += "</tr>";

                //$("#Table1 tr:last").after(row);
                $("#Table1 tbody").append(row);
            }
        }

        function DeleteIt(mypk, row) {

            var cc = new Entity("BP.WF.CCList");
            cc.MyPK = mypk;
            cc.SetPKVal(mypk);
            cc.Delete();
            window.location.href = window.location.href;
            return;
        }


        //确定  执行抄送操作
        function DoCC(empStr) {

            var webUser = new WebUser();
            if (empStr == null || empStr == "")
                return;

            //执行发送.
            var handler = new HttpHandler("BP.WF.HttpHandler.WF_WorkOpt");
            handler.AddPara("Emps", empStr);
            handler.AddPara("WorkID", GetQueryString("WorkID"));
            handler.AddPara("FK_Node", GetQueryString("FK_Node"));
            var data = handler.DoMethodReturnString("CC_Send");

            window.location.href = window.location.href;

            $(".foot").hide();
        }


        //取消移交
        function CloseAll() {
            if (window.parent != null) {
                window.parent.close();
            }
            window.close();
        }

        //设置选中的人员
        function selectEmpsWindowClose(data) {

            $('#selectEmpsModal').modal('hide');
            if (data == '取消') {
                return;
            }

            var nos = frames["iframeSelectEmpsForm"].window.returnVal.No.split(",");
            var names = frames["iframeSelectEmpsForm"].window.returnVal.Name.split(",");
            var strs = "";
            for (var i = 0; i < nos.length; i++) {
                strs += nos[i] + "," + names[i] + ";";
            }

            DoCC(strs);
            return;
            $('#TB_Emps').val(frames["iframeSelectEmpsForm"].window.returnVal.No);
        }

        //删除当前行
        function delRow(nowTr) {
            //$(nowTr).parents("tr").remove();
            $("#Table1 tbody tr:eq(" + nowTr + ")").remove();
        }

        //得到行对象
        function ClearTable() {

            var table = $("#Table1");
            var tbody = $("#Table1 tbody");
            var trArr = $("#Table1 tbody tr");
            tbody.empty();
        }

        $(function () {

            //  $("#TB_Emps").plac
            //人员选择
            $("#TB_Emps").bind('input propertychange', function () {


                if ($("#TB_Emps").val() == null || $("#TB_Emps").val() == "") {
                    //alert("输入内容为空！");
                    //return;
                    $("#SelectEmp").hide().html("");
                    return;
                }

                //执行数据初始化工作.
                var hand = new HttpHandler("BP.WF.HttpHandler.WF_WorkOpt");
                hand.AddUrlData();
                hand.AddPara("TB_Emps", $("#TB_Emps").val());
                var data = hand.DoMethodReturnString("HuiQian_SelectEmps");
                if (data.indexOf('err@') == 0) {
                    alert(data);
                    return;
                }

                //SelectEmp
                //jQuery("#select_id").append("<option value='Value'>Text</option>");  

                data = JSON.parse(data);
                //$("#SelectEmp").hide().html("");
                var html = "";
                for (var i = 0; i < data.length; i++) {
                    //$("#SelectEmp").append("<option value='" + data[i].No + "' onclick=selectAdd('" + data[i].No + "')>" + data[i].Name + "</option>");
                    html = html + "<div class='item' onclick='getCon(\"" + data[i].No + ","+data[i].Name+"\");' onmouseenter='getFocus(this)'>" + data[i].Name + "</div>";
                }
                $("#SelectEmp").show().html(html);

            });
        });

        function selectAdd(No) {
            DoCC(No);
        }

        //鼠标事件
        function getFocus(obj) {
            $(".item").removeClass("addbg");
            $(obj).addClass("addbg");
        }

        //选择下拉数据
        function getCon(no,name) {

            $("#TB_Emps").val('');

            DoCC(no);

            $("#SelectEmp").hide().html("");
        }

        function Help() {
            $("#HelpInfo").toggle();
        }
        function closeWin() {
            window.parent.returnWorkWindowClose("");
        }
    </script>
</head>
<body>

    <div id="labInfo" style="margin-left:20px">
        
        <div style="float:left;margin-top:4px">
            <input type="text" id="TB_Emps" name="TB_Emps"
                   title="查张三,您可输入: zs或zhangs或zhangsan"
                   placeholder="查张三,您可输入: zs或zhangs或zhangsan"
                   value='' style=" width:300px; " />

            <div id="SelectEmp"></div>
        </div>
        <div id="next">

            <button id="Btn_SelectEmps">
                <img src="../Img/Btn/AddLeader.png" /> 选人
            </button>

            <button onclick="closeWin();" id="Btn_Close">
                <img src="../Img/Btn/Close.png" /> 关闭
            </button>

            <a href="javascript:Help()">帮助?</a>

        </div>
        <div class="Msg" style="float: left;">
            <img src='../Img/loading.gif' alt="" />页面数据正在加载中，请稍候......
        </div>
    </div>
    <br/>

    <table class="table table-striped" id="Table1" style="width:98%;padding:5px; margin:10px;">
        <!-- <caption>下一步接受人员列表</caption>-->
        <thead>
            <tr id="title" class="Sum">
                <!--<td style="width:40px; font-weight:bolder">#</td>-->
                <!--<th>编号 </th>-->
                <td style="width:30%; font-weight:bolder">姓名</td>
                <td style="width:40%; font-weight:bolder">所在部门</td>
                <td style="width:60px; font-weight:bolder" colspan="3">操作</td>
            </tr>
        </thead>
        <tbody>
        </tbody>
    </table>
    <div id="HelpInfo" >
        <ul>
            <li>1、此处只是添加被抄送人不执行抄送动作，只有在发送成功后执行抄送动作并在提示信息中显示抄送成功的信息</li>
            <li>2、抄送就是把当前的工作抄送给其他人查阅，但是对方没有审批审核的权限。</li>
            <li>3、被抄送人，可以在抄送列表里查看抄送信息。</li>
            <li>4、可以使用人员名称拼音，支持全拼和简拼。</li>
            <li>例如:查找耿润华您可以输入: grh 或者 gengrh 或者 gengrunhua</li>
            <li>支持单位名称，例如：耿润华/集团信息中心， 可以输入为 grh/jtxxzx</li>
        </ul>
    </div>
</body>
</html>
